home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
cstdio.arc
/
INCLUDE.ARC
/
CTYPE.H
< prev
next >
Wrap
C/C++ Source or Header
|
1985-05-14
|
1KB
|
35 lines
/* ctype.h - character classification macros.
(C) Copyright 1984 Gregory R. Mansfield - All Rights Reserved.
G. R. Mansfield. 84/07/29.
Ver 1.0-5514.
*/
#ifndef _ctype
#define _ctype
#define CT_U 1 /* upper case letter */
#define CT_L 2 /* lower case letter */
#define CT_D 4 /* digit */
#define CT_P 8 /* punctuation */
#define CT_S 16 /* space */
#define CT_X 32 /* hexadecimal digit letters */
#ifndef CTYPEDEF
extern BYTE ctype[256];
#endif
#define isascii(c) ((c) < 0x80)
#define isalpha(c) (ctype[(c)] & (CT_U|CT_L))
#define isupper(c) (ctype[(c)] & CT_U)
#define islower(c) (ctype[(c)] & CT_L)
#define isdigit(c) (ctype[(c)] & CT_D)
#define isxdigit(c) (ctype[(c)] & (CT_D|CT_X))
#define isalnum(c) (ctype[(c)] & (CT_U|CT_L|CT_D))
#define isspace(c) (ctype[(c)] & CT_S)
#define iscntl(c) ((c) < 0x20 || (c) == 0x7F)
#define ispunct(c) (ctype[(c)] & CT_P)
#define isprint(c) (ctype[(c)] & 0x0F)
#define toupper(c) (islower((c)) ? (c)-32 : (c))
#define tolower(c) (isupper((c)) ? (c)+32 : (c))
#endif